<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QDoubleSpinBox Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDoubleSpinBox Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QDoubleSpinBox class provides a spin box widget that takes
doubles. <a href="#details">More...</a></p>

<p>Inherits <a href="qabstractspinbox.html">QAbstractSpinBox</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdoublespinbox.html#QDoubleSpinBox">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />QString <b><a href="qdoublespinbox.html#cleanText">cleanText</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qdoublespinbox.html#decimals">decimals</a></b> (<i>self</i>)</li><li><div class="fn" />QString&#160;<i>str</i> <b><a href="qdoublespinbox.html#fixup">fixup</a></b> (<i>self</i>, QString&#160;<i>str</i>)</li><li><div class="fn" /><b><a href="qdoublespinbox.html#fixup-2">fixup</a></b> (<i>self</i>, QString&#160;<i>str</i>)</li><li><div class="fn" />float <b><a href="qdoublespinbox.html#maximum">maximum</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qdoublespinbox.html#minimum">minimum</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdoublespinbox.html#prefix">prefix</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdoublespinbox.html#setDecimals">setDecimals</a></b> (<i>self</i>, int&#160;<i>prec</i>)</li><li><div class="fn" /><b><a href="qdoublespinbox.html#setMaximum">setMaximum</a></b> (<i>self</i>, float&#160;<i>max</i>)</li><li><div class="fn" /><b><a href="qdoublespinbox.html#setMinimum">setMinimum</a></b> (<i>self</i>, float&#160;<i>min</i>)</li><li><div class="fn" /><b><a href="qdoublespinbox.html#setPrefix">setPrefix</a></b> (<i>self</i>, QString&#160;<i>p</i>)</li><li><div class="fn" /><b><a href="qdoublespinbox.html#setRange">setRange</a></b> (<i>self</i>, float&#160;<i>min</i>, float&#160;<i>max</i>)</li><li><div class="fn" /><b><a href="qdoublespinbox.html#setSingleStep">setSingleStep</a></b> (<i>self</i>, float&#160;<i>val</i>)</li><li><div class="fn" /><b><a href="qdoublespinbox.html#setSuffix">setSuffix</a></b> (<i>self</i>, QString&#160;<i>s</i>)</li><li><div class="fn" /><b><a href="qdoublespinbox.html#setValue">setValue</a></b> (<i>self</i>, float&#160;<i>val</i>)</li><li><div class="fn" />float <b><a href="qdoublespinbox.html#singleStep">singleStep</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdoublespinbox.html#suffix">suffix</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdoublespinbox.html#textFromValue">textFromValue</a></b> (<i>self</i>, float&#160;<i>v</i>)</li><li><div class="fn" />(QValidator.State, QString&#160;<i>input</i>, int&#160;<i>pos</i>) <b><a href="qdoublespinbox.html#validate">validate</a></b> (<i>self</i>, QString&#160;<i>input</i>, int&#160;<i>pos</i>)</li><li><div class="fn" />(QValidator.State, int&#160;<i>pos</i>) <b><a href="qdoublespinbox.html#validate-2">validate</a></b> (<i>self</i>, QString&#160;<i>input</i>, int&#160;<i>pos</i>)</li><li><div class="fn" />float <b><a href="qdoublespinbox.html#value">value</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qdoublespinbox.html#valueFromText">valueFromText</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qdoublespinbox.html#valueChanged">valueChanged</a></b> (double)</li><li><div class="fn" />void <b><a href="qdoublespinbox.html#valueChanged-2">valueChanged</a></b> (const QString&amp;)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDoubleSpinBox class provides a spin box widget that takes
doubles.</p>
<p>QDoubleSpinBox allows the user to choose a value by clicking the
up and down buttons or by pressing Up or Down on the keyboard to
increase or decrease the value currently displayed. The user can
also type the value in manually. The spin box supports double
values but can be extended to use different strings with <a href="qdoublespinbox.html#validate">validate</a>(), <a href="qdoublespinbox.html#textFromValue">textFromValue</a>() and
<a href="qdoublespinbox.html#valueFromText">valueFromText</a>().</p>
<p>Every time the value changes QDoubleSpinBox emits the <a href="qdoublespinbox.html#valueChanged">valueChanged</a>() signal. The
current value can be fetched with <a href="qdoublespinbox.html#value-prop">value</a>() and set with <a href="qdoublespinbox.html#value-prop">setValue</a>().</p>
<p>Note: QDoubleSpinBox will round numbers so they can be displayed
with the current precision. In a QDoubleSpinBox with decimals set
to 2, calling setValue(2.555) will cause <a href="qdoublespinbox.html#value-prop">value</a>() to return 2.56.</p>
<p>Clicking the up and down buttons or using the keyboard
accelerator's Up and Down arrows will increase or decrease the
current value in steps of size <a href="qdoublespinbox.html#singleStep-prop">singleStep</a>(). If you want
to change this behavior you can reimplement the virtual function
<a href="qabstractspinbox.html#stepBy">stepBy</a>(). The minimum
and maximum value and the step size can be set using one of the
constructors, and can be changed later with <a href="qdoublespinbox.html#minimum-prop">setMinimum</a>(), <a href="qdoublespinbox.html#maximum-prop">setMaximum</a>() and <a href="qdoublespinbox.html#singleStep-prop">setSingleStep</a>(). The
spinbox has a default precision of 2 decimal places but this can be
changed using <a href="qdoublespinbox.html#decimals-prop">setDecimals</a>().</p>
<p>Most spin boxes are directional, but QDoubleSpinBox can also
operate as a circular spin box, i.e. if the range is 0.0-99.9 and
the current value is 99.9, clicking "up" will give 0 if <a href="qabstractspinbox.html#wrapping-prop">wrapping</a>() is set to
true. Use <a href="qabstractspinbox.html#wrapping-prop">setWrapping</a>() if you want
circular behavior.</p>
<p>The displayed value can be prepended and appended with arbitrary
strings indicating, for example, currency or the unit of
measurement. See <a href="qdoublespinbox.html#prefix-prop">setPrefix</a>() and <a href="qdoublespinbox.html#suffix-prop">setSuffix</a>(). The text in the
spin box is retrieved with <a href="qabstractspinbox.html#text-prop">text</a>() (which includes any
<a href="qdoublespinbox.html#prefix-prop">prefix</a>() and <a href="qdoublespinbox.html#suffix-prop">suffix</a>()), or with <a href="qdoublespinbox.html#cleanText-prop">cleanText</a>() (which has no
<a href="qdoublespinbox.html#prefix-prop">prefix</a>(), no <a href="qdoublespinbox.html#suffix-prop">suffix</a>() and no leading or
trailing whitespace).</p>
<p>It is often desirable to give the user a special (often default)
choice in addition to the range of numeric values. See <a href="qabstractspinbox.html#specialValueText-prop">setSpecialValueText</a>()
for how to do this with QDoubleSpinBox.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDoubleSpinBox" />QDoubleSpinBox.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a spin box with 0.0 as minimum value and 99.99 as
maximum value, a step value of 1.0 and a precision of 2 decimal
places. The value is initially set to 0.00. The spin box has the
given <i>parent</i>.</p>
<p><b>See also</b> <a href="qdoublespinbox.html#minimum-prop">setMinimum</a>(), <a href="qdoublespinbox.html#maximum-prop">setMaximum</a>(), and <a href="qdoublespinbox.html#singleStep-prop">setSingleStep</a>().</p>


<h3 class="fn"><a name="cleanText" />QString QDoubleSpinBox.cleanText (<i>self</i>)</h3><h3 class="fn"><a name="decimals" />int QDoubleSpinBox.decimals (<i>self</i>)</h3><h3 class="fn"><a name="fixup" />QString&#160;<i>str</i> QDoubleSpinBox.fixup (<i>self</i>, QString&#160;<i>str</i>)</h3><p>Reimplemented from <a href="qabstractspinbox.html#fixup">QAbstractSpinBox.fixup</a>().</p>


<h3 class="fn"><a name="fixup-2" />QDoubleSpinBox.fixup (<i>self</i>, QString&#160;<i>str</i>)</h3><h3 class="fn"><a name="maximum" />float QDoubleSpinBox.maximum (<i>self</i>)</h3><h3 class="fn"><a name="minimum" />float QDoubleSpinBox.minimum (<i>self</i>)</h3><h3 class="fn"><a name="prefix" />QString QDoubleSpinBox.prefix (<i>self</i>)</h3><h3 class="fn"><a name="setDecimals" />QDoubleSpinBox.setDecimals (<i>self</i>, int&#160;<i>prec</i>)</h3><h3 class="fn"><a name="setMaximum" />QDoubleSpinBox.setMaximum (<i>self</i>, float&#160;<i>max</i>)</h3><h3 class="fn"><a name="setMinimum" />QDoubleSpinBox.setMinimum (<i>self</i>, float&#160;<i>min</i>)</h3><h3 class="fn"><a name="setPrefix" />QDoubleSpinBox.setPrefix (<i>self</i>, QString&#160;<i>p</i>)</h3><h3 class="fn"><a name="setRange" />QDoubleSpinBox.setRange (<i>self</i>, float&#160;<i>min</i>, float&#160;<i>max</i>)</h3><p>Convenience function to set the <i>minimum</i> and
<i>maximum</i> values with a single function call.</p>
<p>Note: The maximum and minimum values will be rounded to match
the decimals property.</p>
<pre class="cpp">
 setRange(minimum<span class="operator">,</span> maximum);
</pre>
<p>is equivalent to:</p>
<pre class="cpp">
 <a href="qdoublespinbox.html#minimum-prop">setMinimum</a>(minimum);
 <a href="qdoublespinbox.html#maximum-prop">setMaximum</a>(maximum);
</pre>
<p><b>See also</b> <a href="qdoublespinbox.html#minimum-prop">minimum</a> and <a href="qdoublespinbox.html#maximum-prop">maximum</a>.</p>


<h3 class="fn"><a name="setSingleStep" />QDoubleSpinBox.setSingleStep (<i>self</i>, float&#160;<i>val</i>)</h3><h3 class="fn"><a name="setSuffix" />QDoubleSpinBox.setSuffix (<i>self</i>, QString&#160;<i>s</i>)</h3><h3 class="fn"><a name="setValue" />QDoubleSpinBox.setValue (<i>self</i>, float&#160;<i>val</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setValue(double)</tt>.</p><h3 class="fn"><a name="singleStep" />float QDoubleSpinBox.singleStep (<i>self</i>)</h3><h3 class="fn"><a name="suffix" />QString QDoubleSpinBox.suffix (<i>self</i>)</h3><h3 class="fn"><a name="textFromValue" />QString QDoubleSpinBox.textFromValue (<i>self</i>, float&#160;<i>v</i>)</h3><p>This virtual function is used by the spin box whenever it needs
to display the given <i>value</i>. The default implementation
returns a string containing <i>value</i> printed using <a href="qwidget.html#locale-prop">QWidget.locale</a>().toString(<i>value</i>,
<a href="qlatin1char.html">QLatin1Char</a>('f'), <a href="qdoublespinbox.html#decimals-prop">decimals</a>()) and will remove
the thousand separator. Reimplementations may return anything.</p>
<p>Note: <a href="qdoublespinbox.html">QDoubleSpinBox</a> does not
call this function for <a href="qabstractspinbox.html#specialValueText-prop">specialValueText</a>()
and that neither <a href="qdoublespinbox.html#prefix-prop">prefix</a>() nor <a href="qdoublespinbox.html#suffix-prop">suffix</a>() should be included
in the return value.</p>
<p>If you reimplement this, you may also need to reimplement
<a href="qdoublespinbox.html#valueFromText">valueFromText</a>().</p>
<p><b>See also</b> <a href="qdoublespinbox.html#valueFromText">valueFromText</a>() and
<a href="qlocale.html#groupSeparator">QLocale.groupSeparator</a>().</p>


<h3 class="fn"><a name="validate" />(<a href="qvalidator.html#State-enum">QValidator.State</a>, QString&#160;<i>input</i>, int&#160;<i>pos</i>) QDoubleSpinBox.validate (<i>self</i>, QString&#160;<i>input</i>, int&#160;<i>pos</i>)</h3><p>Reimplemented from <a href="qabstractspinbox.html#validate">QAbstractSpinBox.validate</a>().</p>


<h3 class="fn"><a name="validate-2" />(<a href="qvalidator.html#State-enum">QValidator.State</a>, int&#160;<i>pos</i>) QDoubleSpinBox.validate (<i>self</i>, QString&#160;<i>input</i>, int&#160;<i>pos</i>)</h3><h3 class="fn"><a name="value" />float QDoubleSpinBox.value (<i>self</i>)</h3><h3 class="fn"><a name="valueFromText" />float QDoubleSpinBox.valueFromText (<i>self</i>, QString&#160;<i>text</i>)</h3><p>This virtual function is used by the spin box whenever it needs
to interpret <i>text</i> entered by the user as a value.</p>
<p>Subclasses that need to display spin box values in a non-numeric
way need to reimplement this function.</p>
<p>Note: <a href="qdoublespinbox.html">QDoubleSpinBox</a> handles
<a href="qabstractspinbox.html#specialValueText-prop">specialValueText</a>()
separately; this function is only concerned with the other
values.</p>
<p><b>See also</b> <a href="qdoublespinbox.html#textFromValue">textFromValue</a>() and
<a href="qdoublespinbox.html#validate">validate</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="valueChanged" />void valueChanged (double)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the spin box's value is changed.
The new value is passed in <i>d</i>.</p>


<h3 class="fn"><a name="valueChanged-2" />void valueChanged (const QString&amp;)</h3><p>This is an overloaded function.</p>
<p>The new value is passed literally in <i>text</i> with no
<a href="qdoublespinbox.html#prefix-prop">prefix</a>() or <a href="qdoublespinbox.html#suffix-prop">suffix</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>